package com.hjyoj.judge;

import com.hjyoj.judge.codesandbox.model.JudgeInfo;
import com.hjyoj.judge.strategy.DefaultJudgeStrategy;
import com.hjyoj.judge.strategy.JavaJudgeStrategy;
import com.hjyoj.judge.strategy.JudgeContext;
import com.hjyoj.judge.strategy.JudgeStrategy;
import com.hjyoj.model.entity.QuestionSubmit;
import org.springframework.stereotype.Service;

@Service
/**
 * 管理简化调用
 */ public class JudgeManage {
    public JudgeInfo doJudge(JudgeContext judgeContext) {
        QuestionSubmit questionSubmit = judgeContext.getQuestionSubmit();
        String language = questionSubmit.getLanguage();
        JudgeStrategy javaJudgeStrategy = new DefaultJudgeStrategy();
        if ("java".equals(language)) {
             javaJudgeStrategy = new JavaJudgeStrategy();
        }
        return  javaJudgeStrategy.doJudge(judgeContext);
    }
}
